package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.EpisodePay;
import com.item.mapper.EpisodePayMapper;
import com.item.service.EpisodePayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EpisodePayServiceImpl implements EpisodePayService {

    @Autowired
    EpisodePayMapper episodePayMapper;

    @Override
    public List<EpisodePay> findAll(int limit, int page, EpisodePay episodePay) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return episodePayMapper.findAll(episodePay);
    }

    @Override
    public int add(EpisodePay episodePay) {
        return episodePayMapper.insertSelective(episodePay);
    }

    @Override
    public int update(EpisodePay episodePay) {
        return episodePayMapper.updateByPrimaryKeySelective(episodePay);
    }

    @Override
    public int delete(int id) {
        return episodePayMapper.deleteByPrimaryKey(id);
    }

}
